const types = ['feat', 'fix', 'docs', 'style', 'refactor', 'perf', 'test', 'chore', 'revert', 'ci'];
const issueTypes = ['feat', 'fix', 'refactor', 'perf', 'revert'];
const issue = new RegExp('( {1}#\\d+){1}$');
function checkIssue({ type, subject }) {
  return !issueTypes.includes(type) || issue.test(subject);
}
module.exports = {
  rules: {
    'type-enum': [2, 'always', types],
    'commit-issue': [2, 'always']
  },
  plugins: [
    {
      rules: {
        'commit-issue': ({ type, subject }) => [
          checkIssue({ type, subject }),
          '请在备注信息中补全任务单号：issue格式[xxx #9999]\n\t\tissue: 需求/任务/缺陷等编号。\n'
        ]
      }
    }
  ]
};
